require(['./config'], () => {
    require(['template', 'header', 'footer'], (template) => {
        class Index {
            constructor() {
                this.init()
                this.getList()
                this.getRap2()
            }
            init() {
                const url = "http://xiongmaoyouxuan.com/api/search?word=%E6%B0%B4%E6%9E%9C&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=99999"
                $.get(url, resp => {
                    // console.log(resp.data.list.slice(0, 3))
                    const html = template('listsTemplate', {
                        lists: resp.data.list
                    })
                    $('#shop-lists').html(html)

                })
            }
            getList() {
                const url = "http://xiongmaoyouxuan.com/api/search?word=%E6%B0%B4%E6%9E%9C&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=99999"
                $.get(url, resp => {
                    // console.log(resp.data.list.slice(0, 3))
                    const html = template('listTemplate', {
                        lists: resp.data.list.slice(4, 8)
                    })
                    $('.fff').html(html)

                })
            }
            getRap2() {
                const url = "http://rap2.taobao.org:38080/app/mock/264511/kkk"
                $.get(url, resp => {
                    console.log(resp.body.list)
                    const html = template('list2Template', {
                            lists: resp.body.list
                        })
                        // console.log(html)
                    $('.fff2').html(html)

                })
            }
        }
        new Index()
    })
})